<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>2_3_1-3-遍历索引，绑定key值</title>
</head>

<body>


  <!--载入vue.js-->
  <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>

  <div id="Application">
    <ol>
      <li v-for="(value,key,index) in preson " :key="index">{{key}}：{{value}}</li>
    </ol>
    绑定ky值可更好地对列表项进行重用,
    如果我们对每个元素都有唯一的键引用，那么我们就可以更好地准确地预测DOM将如何操作
  </div>

  <script>
    //定义一个组件，名为App
    const App = {
      //组件的data方法，提供应用所需全局数据
      data() {
        //返回对象
        return {
          preson: {
            name: "辉少",
            age: "00",
            num: "asdfsadf",
            email: "xxx@xx.cn",
          },
        };
      },
    };

    Vue.createApp(App).mount("#Application"); //将Vue组件绑定到页面上id为Application的元素上。
  </script>
</body>

</html>